home *** CD-ROM | disk | FTP | other *** search
- ///////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////
- // This example code is from the book:
- //
- // Object-Oriented Programming with C++ and OSF/Motif
- // by
- // Douglas Young
- // Prentice Hall, 1992
- // ISBN 0-13-630252-1
- //
- // Copyright 1991 by Prentice Hall
- // All Rights Reserved
- //
- // Permission to use, copy, modify, and distribute this software for
- // any purpose except publication and without fee is hereby granted, provided
- // that the above copyright notice appear in all copies of the software.
- ///////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////
-
-
- ////////////////////////////////////////////////////////
- // hello.C, Hello World using C++ and Motif
- ////////////////////////////////////////////////////////
- #include <Xm/Xm.h>
- #include <Xm/Label.h>
-
- #if (XlibSpecificationRelease>=5)
- void main ( int argc, char **argv )
- #else
- void main ( unsigned int argc, char **argv )
- #endif
- {
- Widget label, toplevel;
- XtAppContext app;
- XmString xmstr;
- Arg args[10];
- int n;
-
- // Initialize the Intrinsics
-
- toplevel = XtAppInitialize ( &app, "Hello", NULL, 0,
- &argc, argv, NULL, NULL, 0 );
-
- // Create a compound string to display the Hello message
-
- xmstr = XmStringCreateSimple ( "Hello World" );
-
- // Create a label widget to display the string
-
- n = 0;
- XtSetArg ( args[n], XmNlabelString, xmstr ); n++;
- label = XtCreateManagedWidget ( "label", xmLabelWidgetClass,
- toplevel, args, n );
-
- // Free the compound string when it is no longer needed.
-
- XmStringFree ( xmstr );
-
- // Realize all widgets and enter the main event loop
-
- XtRealizeWidget ( toplevel );
- XtAppMainLoop ( app );
- }
-